<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
    <title></title>
    <!-- Bootstrap Core CSS -->
    <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="css/style.css" rel="stylesheet">
    <!-- You can change the theme colors from here -->
    <link href="css/colors/blue.css" id="theme" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
 <script src="js/jquery.js"></script>
<script>
    function quit(){
        var r = confirm('确定注销?');
        if(r == true){
            window.location.href='http://127.0.0.1:8848/t/moban453/index.html';
        }
    }
</script>

</head>

<body class="fix-header card-no-border">
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader">
        <svg class="circular" viewBox="25 25 50 50">
            <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
    </div>
    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <div id="main-wrapper">
        <!-- ============================================================== -->
        <!-- Topbar header - style you can find in pages.scss -->
        <!-- ============================================================== -->
        <header class="topbar">
            <nav class="navbar top-navbar navbar-toggleable-sm navbar-light">
                <!-- ============================================================== -->
                <!-- Logo -->
                <!-- ============================================================== -->
                <div class="navbar-header">
                    <a class="navbar-brand" href="table-basic.html">
                        <!-- Logo icon -->
                        <b>
                            <!--You can put here icon as well // <i class="wi wi-sunset"></i> //-->
                            <!-- Dark Logo icon -->
                            <img src="assets/images/logo-icon.png" alt="table-basic.html" class="dark-logo" />
                            
                        </b>
                        <!--End Logo icon -->
                        <!-- Logo text -->
                        <span>
                         <!-- dark Logo text -->
                           <img   class="dark-logo" />图书后台管理系统
                         </span> </a>
                </div>
                <!-- ============================================================== -->
                <!-- End Logo -->
                <!-- ============================================================== -->
                <div class="navbar-collapse">
                    <!-- ============================================================== -->
                    <!-- toggle and nav items -->
                    <!-- ============================================================== -->
                    <ul class="navbar-nav mr-auto mt-md-0 ">
                        <!-- This is  -->
                        <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up text-muted waves-effect waves-dark" href="javascript:void(0)"><i class="ti-menu"></i></a> </li>
                        
                    </ul>
                    <!-- ============================================================== -->
                    <!-- User profile and search -->
                    <!-- ============================================================== -->
                    <h1>广西科技大学图书管理系统</h1>
                    <ul class="navbar-nav my-lg-0">
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-muted waves-effect waves-dark" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="assets/images/users/1.jpg" alt="user" class="profile-pic m-r-5" />宇宙可爱帅气管理员</a>
                      <a href="#" onclick="quit()">注销</a>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <!-- ============================================================== -->
        <!-- End Topbar header -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- Left Sidebar - style you can find in sidebar.scss  -->
        <!-- ============================================================== -->
        <aside class="left-sidebar">
            <!-- Sidebar scroll-->
            <div class="scroll-sidebar">
                <!-- Sidebar navigation-->
                <nav class="sidebar-nav">
                    <ul id="sidebarnav">
                       <li>
                           <a href="table-basic.html" class="waves-effect"><i class="fa fa-table m-r-10" aria-hidden="true"></i>图书信息</a>
                       </li>
                        <li>
                            <a href="pages-profile.html" class="waves-effect"><i class="fa fa-user m-r-10" aria-hidden="true"></i>个人信息</a>
                        </li>
                        
                        <li>
                            <a href="icon-fontawesome.html" class="waves-effect"><i class="fa fa-font m-r-10" aria-hidden="true"></i>用户管理</a>
                        </li>
                       
                       
                        
                    </ul>
                    
                </nav>
                <!-- End Sidebar navigation -->
            </div>
            <!-- End Sidebar scroll-->
        </aside>
        <!-- ============================================================== -->
        <!-- End Left Sidebar - style you can find in sidebar.scss  -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
           <div class="row">
               <!-- column -->
               <div class="col-sm-12">
                   <div class="card">
                       <div class="card-block">
                           <h4 class="card-title"><a href="修改图书信息.html">修改图书信息</a></h4>
                           <div class="table-responsive">
                               <table class="table">
                                   <thead>
                                       <tr>
                                           <th>书号(不可修改)</th>
                                           <th>书名</th>
                                           <th>作者</th>
                                           <th>类别</th>
                                           <th>价格</th>
                                           <th>出版社</th>
                                           <th>库存量</th>
                                       </tr>
                                   </thead>
                                   <tbody id="table1">
                                       
                                     <tr></tr>
                                  <th><input type="text" id="book_id" readonly /></th>
                                  <th><input type="text" id="book_name"/></th>
                                  <th><input type="text" id="book_autho"/></th>
                                  <th><input type="text" id="book_classes"/></th>
                                  <th><input type="text" id="book_price"/></th>
                                  <th><input type="text" id="book_public"/></th>
                                  <th><input type="text" id="book_surplus"/></th>            
                                      </tr>     
                                      <th><input type="button" value="确认修改" onclick="update()"/></th>    
                                   
                                       
                                   </tbody>
                               </table>
                           </div>
                       </div>
                   </div>
               </div>
           </div>
                </div>
                <!-- ============================================================== -->
                <!-- End Bread crumb and right sidebar toggle -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-block">
                                This is some text within a card block.
                            </div>
                        </div>
                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- footer -->
            <!-- ============================================================== -->
            
            <!-- ============================================================== -->
            <!-- End footer -->
            <!-- ============================================================== -->
        </div>
        <!-- ============================================================== -->
        <!-- End Page wrapper  -->
        <!-- ============================================================== -->
    </div>
    <!-- ============================================================== -->
    <!-- End Wrapper -->
    <!-- ============================================================== -->
    <!-- ============================================================== -->
    <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="assets/plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="assets/plugins/bootstrap/js/tether.min.js"></script>
    <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="js/jquery.slimscroll.js"></script>
    <!--Wave Effects -->
    <script src="js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="js/sidebarmenu.js"></script>
    <!--stickey kit -->
    <script src="assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
    <!--Custom JavaScript -->
    <script src="js/custom.min.js"></script>
    <!-- ============================================================== -->
    <!-- Style switcher -->
    <!-- ============================================================== -->
    <script src="assets/plugins/styleswitcher/jQuery.style.switcher.js"></script>
    <script>
    	function GetQueryString(name){
    	                var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    	                var r = window.location.search.substr(1).match(reg);
    	                if(r!=null)return  unescape(r[2]); return null;
    	
    	}
    	
    	var name= GetQueryString("name");
    
            $.ajax({
                type:"post",
                url:"http://127.0.0.1:8080/book_Info?book_id="+name,
                dataType: 'json',
                success:function(data){  
                   
                   $("#book_id").attr("value",data.id);  
                   $("#book_name").attr("value",data.book_name);  
                   $("#book_autho").attr("value",data.book_author);  
                   $("#book_classes").attr("value",data.book_classes);  
                   $("#book_price").attr("value",data.book_price);  
                   $("#book_public").attr("value",data.book_public);  
                   $("#book_surplus").attr("value",data.book_surplus);  
                }
            });
            function update(){
               var id=$("#book_id").val();
               var name=$("#book_name").val();
               var autho=$("#book_autho").val();
               var classes=$("#book_classes").val();
               var price=$("#book_price").val();
               var public1=$("#book_public").val();
               var surplus=$("#book_surplus").val();
               var json={"book_id":id,"book_name":name,"book_author":autho,"book_classes":classes,"book_price":price,"book_public":public1,"book_surplus":surplus};
              
               $.ajax({
                   type:'post',
                    url:'http://127.0.0.1:8080/updateBook',
                 contentType: "application/x-www-form-urlencoded", //传过去的数据类型，此为表单
                 data:json,
         
                   success:function(){
                        alert("修改成功");
                        window.location.href='table-basic.html';
                   },
                    error:function(){
                           alert("修改失败");
                          window.location.href='修改图书信息.html?name='+id;
                       
                       
                       }
                       
               })
            }

    
    	
    	
    </script>
</body>

</html>
